#tag Class
Class NSPasteboardItem
Inherits NSObject
	#tag Method, Flags = &h0
		Function AvailableType(types() as String) As String
		  
		  #if targetMacOS
		    declare function availableTypeFromArray lib CocoaLib selector "availableTypeFromArray:" (obj_id as Ptr, types as Ptr) as CFStringRef
		    
		    dim returnString as String
		    
		    if types.ubound > -1 then
		      dim ns_array as new NSArray(types)
		      returnString = availableTypeFromArray(self, ns_array)
		    end if
		    
		    return returnString
		    
		  #else
		    #pragma unused types
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Sub Constructor()
		  
		  super.Constructor(Initialize(Allocate("NSPasteboardItem")), NSPasteboardItem.hasOwnership)
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h0
		Function Data(type as String) As String
		  
		  #if targetMacOS
		    declare function dataForType lib CocoaLib selector "dataForType:" (obj_id as Ptr, type as CFStringRef) as Ptr
		    
		    dim stringData as String
		    
		    dim d as new NSData(dataForType(self, type), not NSData.hasOwnership)
		    
		    if d <> nil then
		      stringData = d.data.StringValue(0, d.data.size)
		    end if
		    
		    return stringData
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function PropertyList(dataType as String) As Ptr
		  
		  #if targetMacOS
		    declare function propertyListForType lib CocoaLib selector "propertyListForType:" (obj_id as Ptr, dataType as CFStringRef) as Ptr
		    
		    return propertyListForType(self, dataType)
		    
		  #else
		    #pragma unused dataType
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function PropertyListForType(type as String) As variant
		  #if TargetMacOS
		    declare function propertyListForType lib CocoaLib selector "propertyListForType:" (id as Ptr, type as CFStringRef) as Ptr
		    
		    dim p as Ptr
		    p = propertyListForType( me.id, type )
		    
		    return   Cocoa.NSObjectFromNSPtr( p )
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function SetData(data as String, type as String) As Boolean
		  
		  #if targetMacOS
		    declare function setData lib CocoaLib selector "setData:forType:" (obj_id as Ptr, data as Ptr, type as CFStringRef) as Boolean
		    
		    dim d as new NSData(data)
		    
		    return setData(self, d, type)
		    
		  #else
		    #pragma unused data
		    #pragma unused type
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function SetPropertyList(aPropertyList as Ptr, dataType as String) As Boolean
		  
		  #if targetMacOS
		    declare function setPropertyList lib CocoaLib selector "setPropertyList:forType:" (obj_id as Ptr, aPropertyList as Ptr, dataType as CFStringRef) as Boolean
		    
		    return setPropertyList(self, aPropertyList, dataType)
		    
		  #else
		    #pragma unused aPropertyList
		    #pragma unused dataType
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function SetStringData(aString as String, dataType as String) As Boolean
		  
		  #if targetMacOS
		    declare function setString lib CocoaLib selector "setString:forType:" (obj_id as Ptr, aString as CFStringRef, dataType as CFStringRef) as Boolean
		    
		    return setString(self, aString, dataType)
		    
		  #else
		    #pragma unused aString
		    #pragma unused dataType
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function StringData(dataType as String) As String
		  
		  #if targetMacOS
		    declare function stringForType lib CocoaLib selector "stringForType:" (obj_id as Ptr, dataType as CFStringRef) as CFStringRef
		    
		    return stringForType(self, dataType)
		    
		  #else
		    #pragma unused dataType
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function Types() As String()
		  
		  #if targetMacOS
		    declare function types lib CocoaLib selector "types" (obj_id as Ptr) as Ptr
		    
		    dim rb_array() as String
		    
		    dim nsarrayRef as Ptr = types(self)
		    if nsarrayRef <> nil then
		      rb_array = new NSArray(nsarrayRef)
		    end if
		    
		    return rb_array
		    
		  #endif
		  
		End Function
	#tag EndMethod


	#tag ViewBehavior
		#tag ViewProperty
			Name="Description"
			Group="Behavior"
			Type="String"
			EditorType="MultiLineEditor"
			InheritedFrom="NSObject"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Index"
			Visible=true
			Group="ID"
			InitialValue="-2147483648"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Left"
			Visible=true
			Group="Position"
			InitialValue="0"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Name"
			Visible=true
			Group="ID"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Super"
			Visible=true
			Group="ID"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Top"
			Visible=true
			Group="Position"
			InitialValue="0"
			InheritedFrom="Object"
		#tag EndViewProperty
	#tag EndViewBehavior
End Class
#tag EndClass
